package com.qf.chinatelcom.apiinterface.service.impl;

import com.qf.chinatelcom.apiinterface.service.SmsMQService;
import com.qianfeng.smsplatform.common.constants.RabbitMqConsants;
import com.qianfeng.smsplatform.common.model.Standard_Submit;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsMQServiceImpl implements SmsMQService {

    private RabbitTemplate rabbitTemplate;

    @Autowired
    public void setRabbitTemplate(RabbitTemplate rabbitTemplate) {
        this.rabbitTemplate = rabbitTemplate;
    }

    @Override
    public void sendSms2Mq(List<Standard_Submit> standard_submits) {
        standard_submits.forEach(standard_submit -> {
            rabbitTemplate.convertAndSend(RabbitMqConsants.TOPIC_PRE_SEND,standard_submit);
        });
    }
}
